<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        var array=[-1,1,3,4,6,10];
        array.sort((a,b)=>Math.abs(a)-Math.abs(b))
        document.write(array)
    </script>
</head>
<body>
    
</body>
</html>